<template>
  <div>
    <el-card>
      <el-row :gutter="20">
        <el-col :span="24">
          <el-card shadow="never" style="box-shadow: none !important;">
            <div slot="header" class="clearfix">
              <span>系统重启</span>
            </div>

            <!-- 表单配置 -->
            <el-form ref="baseform" :model="form" label-width="240px">
              <el-form-item label="系统或数据库升级后需要重启系统" prop="dbnet">
                <el-button type="primary" @click="onSubmit">重启系统(服务器)</el-button>
                <el-button @click="onCancel">关闭系统</el-button>
              </el-form-item>

            </el-form>
          </el-card>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
import { sysversion, sqlupdate } from '@/api/system/sysupdate.js'
export default {
  data() {
    return {
      Version: '',
      // 表单字段
      form: {
        Version: ''
      }
    }
  },
  created() {
    this.getversion()
  },
  methods: {
    getversion() {
      sysversion().then(res => {
        this.Version = res.data.data.DbVersion
      })
    },
    onSubmit() {
      // 表单提交
      this.$refs.baseform.validate(valid => {
        if (!valid) return
        // 表单设置
        sqlupdate(this.form).then(res => {
          if (res.data.meta.status === 200) {
            this.$message.success('修改成功')
            this.getbaseinfo()
          }
        })
      })
    },
    onCancel() {
      this.$router.back(-1)
    }
  }
}
</script>

<style>
  .questionIco {
    cursor: pointer;
    padding-left: 20px;
    color: #EE9900;
    font-size: 16px;
  }
  .el-popper[x-placement^=right] .popper__arrow::after {
    border-right-color: #EE9900;
  }
</style>
